import type { UserConfig } from 'vite'

export default (): UserConfig => {
  return {
    // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
    // prevent vite from obscuring rust errors
    clearScreen: false,
    // tauri expects a fixed port, fail if that port is not available
    server: {
      port: 1421, // 不要改!!!
      strictPort: true, // 不要改!!
      proxy: {
        // '/api/common/bigFile': {
        //   target: 'https://oa.hzgjbbg.cn/proxy',
        //   changeOrigin: true,
        //   rewrite: (path: string) => path.replace(/^\/api/, '')
        // },
        // '/api/common/annexFile/listByIds': {
        //   target: 'https://oa.hzgjbbg.cn/proxy',
        //   changeOrigin: true,
        //   rewrite: (path: string) => path.replace(/^\/api/, '')
        // },
        '/api': {
          target: 'https://oatest.hzgjbbg.cn:8061/proxy/', //馆内测试
          // target: 'https://oa.hzgjbbg.cn/proxy/', //馆内正式
          // target: 'http://211.90.243.252:8074/', //测试
          // target: 'http://211.90.241.209:8074/', //开发
          // target: 'http://192.168.1.101:8074/', //家俊
          // target: 'http://192.168.1.113:8074/', //家俊-版本馆
          // target: 'http://192.168.3.50:8074/', //甘某
          // target: 'http://192.168.3.115:8074/', //栋一
          // target: 'http://192.168.3.129:8074', //文豪
          // target: 'http://192.168.110.148:8074', //张伟峰-版本馆
          changeOrigin: true,
          rewrite: (path: string) => path.replace(/^\/api/, '')
        },
        '/jsonapi': {
          target: 'https://oatest.hzgjbbg.cn:8061/json',
          // target: 'http://211.90.243.252:8078/json',
          // target: 'http://localhost:3000',
          changeOrigin: true,
          rewrite: (path: string) => path.replace(/^\/jsonapi/, '')
        },
        '/imgapi': {
          target: 'https://oatest.hzgjbbg.cn:8061/collection_icon/',
          changeOrigin: true,
          rewrite: (path: string) => path.replace(/^\/imgapi/, '')
        }
      }
    }
  }
}
